/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package mx.edu.itschapala.sistemas.septimo.vista;

import javax.swing.JFrame;
import mx.edu.itschapala.sistemas.septimo.control.ClienteLnLocal;
import mx.edu.itschapala.sistemas.septimo.modelo.Cliente;
import mx.edu.itschapala.sistemas.septimo.vista.enumeracion.TipoVentana;

/**
 *
 * @author ZATHLER
 */
public class DialogoC extends javax.swing.JFrame {

    private Cliente cliente;
    private ClienteLnLocal clienteControl;
    private JFrame edit;
    /**
     * Creates new form DialogoC
     */
    public DialogoC(Cliente cliente, ClienteLnLocal clienteControl) {
        this.cliente=cliente;
        this.clienteControl=clienteControl;
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        boEdita = new javax.swing.JButton();
        boElimina = new javax.swing.JButton();
        mejorNo = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        boEdita.setText("Editar");
        boEdita.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                boEditaActionPerformed(evt);
            }
        });

        boElimina.setText("Eliminar");
        boElimina.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                boEliminaActionPerformed(evt);
            }
        });

        mejorNo.setText("Cancelar");
        mejorNo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mejorNoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(boEdita)
                .addGap(18, 18, 18)
                .addComponent(boElimina)
                .addGap(18, 18, 18)
                .addComponent(mejorNo)
                .addGap(25, 25, 25))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(boEdita)
                    .addComponent(boElimina)
                    .addComponent(mejorNo))
                .addGap(12, 12, 12))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void boEditaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boEditaActionPerformed
        if(edit==null){
        edit=new RegistrarC(cliente, clienteControl, TipoVentana.VENTANA_MODIFICAR);
        }
        edit.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_boEditaActionPerformed

    private void boEliminaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boEliminaActionPerformed
       if(edit==null){
        edit=new RegistrarC(cliente, clienteControl, TipoVentana.VENTANA_ELIMINAR);
        }
        edit.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_boEliminaActionPerformed

    private void mejorNoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mejorNoActionPerformed
        this.dispose();
    }//GEN-LAST:event_mejorNoActionPerformed

    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton boEdita;
    private javax.swing.JButton boElimina;
    private javax.swing.JButton mejorNo;
    // End of variables declaration//GEN-END:variables
}
